// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   Change.java

package include.calculator;


public class Change
{

	private String word;

	public Change(String word)
	{
		this.word = null;
		this.word = word;
	}

	public String execute(String str1[], String str2[])
	{
		if (str1.length == str2.length)
		{
			for (int i = 0; i < str1.length; i++)
				replace(str1[i], str2[i]);

		}
		return word;
	}

	public void replace(String str1, String str2)
	{
		int index = 0;
		String temp = "";
		if ((index = word.indexOf(str1)) != -1)
		{
			if (index > 0)
			{
				temp = (new StringBuilder(String.valueOf(temp))).append(word.substring(0, index)).append(str2).toString();
				word = word.substring(index + str1.length(), word.length());
				word = (new StringBuilder(String.valueOf(temp))).append(word).toString();
			} else
			if (index == 0)
			{
				temp = (new StringBuilder(String.valueOf(temp))).append(str2).toString();
				word = word.substring(str1.length(), word.length());
				word = (new StringBuilder(String.valueOf(temp))).append(word).toString();
			}
			replace(str1, str2);
		} else
		{
			return;
		}
	}

	public static void main(String args[])
	{
		String one = " 10 ";
		String str1[] = {
			"three", "one", "five", "two"
		};
		String str2[] = {
			" 3 ", one, " 5 ", " 2 "
		};
	}
}
